import { Controller, Get, Post, Body, Param, Delete, Query } from '@nestjs/common';
import { BlogTagService } from './blog_tag.service';
import { CreateBlogTagDto } from './dto/create-blog_tag.dto';
import { UpdateBlogTagDto } from './dto/update-blog_tag.dto';

@Controller('blogTag')
export class BlogTagController {
  constructor(private readonly blogTagService: BlogTagService) {}

  @Post('create')
  async createCategory(@Body() createBlogTagDto: CreateBlogTagDto) {
    return await this.blogTagService.createCategory(createBlogTagDto)
  }

  @Get('list')
  async getAllCategory() {
    return await this.blogTagService.findAll()
  }

  @Get('getCategoryById')
  async getCategoryById(@Query('id') id: number) {
    return await this.blogTagService.findOneById(id)
  }

  @Post('update')
  async updateCategory(@Body() updateBlogTagDto:UpdateBlogTagDto) {
    return await this.blogTagService.update(updateBlogTagDto)
  }

  @Delete('removeById/:id')
  async removeCategory(@Param() id: number) {
    return await this.blogTagService.removeById(id);
  }
}
